﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Contacts.aspx.cs" Inherits="Contacts"
    MasterPageFile="~/Admin/MasterPage.master" EnableEventValidation="false" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<asp:Content ID="Content1" runat="Server" ContentPlaceHolderID="MainContent">

    <script type="text/javascript">
function checkLength(con)
{
if(con.value.length >= 98)
{
return false;
}
else
{
document.getElementById('ctl00_MainContent_lblChars').innerHTML = 'осталось символов '+(98 - con.value.length)  ;return true;
}
}
function setRemaining()
{
document.getElementById('ctl00_MainContent_lblChars').innerHTML = 'осталось символов '+(98 - document.getElementById('ctl00_MainContent_txtContent').value.length);
if (document.getElementById('ctl00_MainContent_txtContent').value.length > 98)
{
document.getElementById('ctl00_MainContent_txtContent').value = document.getElementById('ctl00_MainContent_txtContent').value.substring(0,98);
}
}
    </script>
    <h1>Контакты</h1><br />
    <div class="RegularBold">
        Page keywords</div>
    <asp:TextBox runat="server" ID="txtKeywords" Width="500px"></asp:TextBox>
    <br />
    <div class="RegularBold">
        Page description</div>
    <asp:TextBox runat="server" ID="txtDescription" Width="500px"></asp:TextBox>
    <div class="RegularBold">
        Browser title</div>
    <asp:TextBox runat="server" ID="txtBrowserTitle" Width="500px"></asp:TextBox>
    <br />
    <asp:Button ID="Button2" runat="server" Text="Сохранить" OnClick="btnAddDescription_Click">
    </asp:Button>
    <br />
    <asp:Label runat="server" CssClass="RegularText" ID="lblEmail" Text="Ваша электронная почта:"></asp:Label>
    <asp:TextBox runat="server" ID="txtEmail" Width="430px"></asp:TextBox>
    <br />
    <div class="RegularBold">
        Текст блока связь с нами</div>
    <asp:Label runat="server" ID="lblChars" Text="осталось символов 98"></asp:Label><br />
    <asp:TextBox runat="server" ID="txtContent" onkeypress="return checkLength(this);"
        onkeyup="setRemaining();" Width="480px" Height="110px" MaxLength="98" TextMode="MultiLine"></asp:TextBox>
    <br />
    <asp:Button runat="server" ID="btnSaveEmail" Text="Сохранить" OnClick="btnSaveEmails_Click" />
    <br />
    <img src="images/Delimiter.png" border="0" alt="">
    <div class="RegularBold">
        Вопросы обращения:</div>
    <asp:GridView ID="gvQuestions" runat="server" AutoGenerateColumns="false" CssClass="SiteStats"
        AllowPaging="false" AlternatingRowStyle-CssClass="SiteStatsA" RowStyle-CssClass="SiteStats"
        Width="98%" AllowSorting="false" OnRowDataBound="gvQuestions_RowBound">
        <Columns>
            <asp:BoundField DataField="Question" HeaderText="Отображаемый текст" HeaderStyle-CssClass="StatsHeader" />
            <asp:TemplateField HeaderText="Действие" HeaderStyle-CssClass="StatsHeader" ItemStyle-VerticalAlign="Middle">
                <ItemTemplate>
                    <asp:ImageButton runat="server" ToolTip="Click to move this row up" ImageUrl="Images/MoveUp.png"
                        ID="btnUp" OnCommand="gvPartners_ItemCommand" CausesValidation="false" CommandName="MoveUp"
                        CommandArgument='<%# Eval("ID") %>' />
                    <asp:ImageButton runat="server" ToolTip="Click to move this row down" ImageUrl="Images/MoveDown.png"
                        CommandName="MoveDown" ID="btnDown" OnCommand="gvPartners_ItemCommand" CommandArgument='<%# Eval("ID") %>' />
                    <asp:Button OnCommand="btnDeletePartner_Click" CausesValidation="false" UseSubmitBehavior="false"
                        CommandArgument='<%# Eval("ID") %>' Text='удалить' ID="btnDeletePartner" CssClass="but"
                        runat="server" />
                    <asp:Button OnCommand="btnEditPartner_Click" UseSubmitBehavior="false" CommandArgument='<%# Eval("ID") %>'
                        Text="редактировать" runat="server" ID="btnEditLnk" CssClass="but" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <table>
        <tr>
            <td>
                <asp:HiddenField runat="server" ID="hfQuestion" />
                <asp:Label runat="server" CssClass="RegularText" ID="lblAddPartner" Text="Добавить вопрос:"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" CssClass="RegularText" ID="lblAddPartnerText" Text="Отображаемый текст:"></asp:Label>
            </td>
            <td>
                <asp:TextBox runat="server" CssClass="TextField" ID="txtQuestion"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button runat="server" ID="btnAddQuestion" Text="Добавить" OnClick="btnAddQuestion_Click" />
            </td>
        </tr>
    </table>
    <br />
    <img src="images/Delimiter.png" border="0" alt="">
    <div class="RegularBold">
        Полученые сообщения</div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:MultiView runat="server" ID="MultiView1">
                <asp:View ID="Grid" runat="server">
                    <asp:GridView ID="gvMails" runat="server" AutoGenerateColumns="false" CssClass="SiteStats"
                        AllowPaging="true" AlternatingRowStyle-CssClass="SiteStatsA" RowStyle-CssClass="SiteStats"
                        Width="1000px" AllowSorting="true" OnRowDataBound="gvMails_RowBound" PagerSettings-Visible="true"
                        PageSize="40" OnPageIndexChanging="gvMails_PageindexChanging">
                        <Columns>
                            <asp:BoundField DataField="InsertDate" SortExpression="Date" HeaderText="Дата" HeaderStyle-CssClass="StatsHeader" />
                            <asp:BoundField DataField="FromName" HeaderText="Имя" SortExpression="Title" HeaderStyle-CssClass="StatsHeader" />
                            <asp:BoundField DataField="From" HeaderText="E-mail" HeaderStyle-CssClass="StatsHeader" />
                            <asp:BoundField DataField="Phone" HeaderText="Телефон" HeaderStyle-CssClass="StatsHeader" />
                            <asp:BoundField DataField="Question" HeaderText="По вопросу" HeaderStyle-CssClass="StatsHeader" />
                            <asp:TemplateField HeaderText="Действия" HeaderStyle-CssClass="StatsHeader">
                                <ItemTemplate>
                                    <asp:Button OnCommand="btnViewMail_Click" CausesValidation="false" UseSubmitBehavior="false"
                                        CommandArgument='<%# Eval("ID") %>' Text='Посмотреть' ID="btnViewMail" CssClass="but"
                                        runat="server" />
                                    <asp:Button OnCommand="btnAnswer_Click" CausesValidation="false" UseSubmitBehavior="false"
                                        CommandArgument='<%# Eval("ID") %>' Text='Ответить' ID="Button1" CssClass="but"
                                        runat="server" />
                                    <asp:Button OnCommand="btnDeleteMail_Click" CausesValidation="false" UseSubmitBehavior="false"
                                        CommandArgument='<%# Eval("ID") %>' Text='удалить' ID="btnDeleteMail" CssClass="but"
                                        runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EmptyDataTemplate>
                            Нет полученых писем
                        </EmptyDataTemplate>
                    </asp:GridView>
                </asp:View>
                <asp:View ID="View" runat="server">
                    <asp:HiddenField runat="server" ID="hfMailID" />
                    <asp:Literal runat="server" ID="ltViewMail"></asp:Literal><br />
                    <asp:Button runat="server" ID="btnBack" OnClick="btnBack_Click" />
                    <asp:Button runat="server" ID="btnAnswer" Text="Ответить" OnClick="btnAnswer_Click" />
                </asp:View>
                <asp:View runat="server" ID="Answer">
                <asp:Label runat="server" ID="lblAnswerTo" Text="Ответ на сообщение от: "></asp:Label>
                 <FCKeditorV2:FCKeditor runat="server" ID="edMail" BasePath="~/fckeditor/" Width="651px"
                    EnableViewState="true" Height="228px" ToolbarSet="Basic"></FCKeditorV2:FCKeditor>
                    <asp:Button runat="server" ID="btnBack1" OnClick="btnBack_Click" />
                 <asp:Button runat="server" ID="btnSendMail" Text="Отправить" OnClick="btnSendMail_Click" />
                </asp:View>
            </asp:MultiView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
